package com.ruoyi.project.wx.service.impl;


import com.github.pagehelper.PageInfo;
import com.ruoyi.common.utils.bootdo.PageHelperUtils;
import com.ruoyi.common.utils.bootdo.R;
import com.ruoyi.project.wx.dao.ChinaAreaDao;
import com.ruoyi.project.wx.domain.ChinaAreaDO;
import com.ruoyi.project.wx.service.ChinaAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class ChinaAreaServiceImpl implements ChinaAreaService {
	@Autowired
	private ChinaAreaDao chinaAreaDao;
	
	@Override
	public ChinaAreaDO get(Long id){
		return chinaAreaDao.get(id);
	}
	
	@Override
	public List<ChinaAreaDO> list(Map<String, Object> map){
		return chinaAreaDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return chinaAreaDao.count(map);
	}
	
	@Override
	public int save(ChinaAreaDO chinaArea){
		return chinaAreaDao.save(chinaArea);
	}
	
	@Override
	public int update(ChinaAreaDO chinaArea){
		return chinaAreaDao.update(chinaArea);
	}
	
	@Override
	public int remove(Long id){
		return chinaAreaDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return chinaAreaDao.batchRemove(ids);
	}

    @Override
    public List<ChinaAreaDO> likeList(Map<String, Object> map){
        return chinaAreaDao.likeList(map);
    }
    @Override
    public int likeListCount(Map<String, Object> map){
        return chinaAreaDao.likeListCount(map);
    }

    @Override
    public R getCity(Map<String, Object> params) {
		params.put("hasChildren",1);
		params.put("isCity",1);
		PageHelperUtils.page(params);
		List<Map<String,Object>> cityList =  chinaAreaDao.getCity(params);
		PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(cityList);
		return R.ok().put("data",pageInfo);
    }


}
